import basepage as basepage
from selenium.webdriver.common.by import By

from test_wechat.train_step2.PO.basepage import BasePage


class addmember_page(BasePage):
    username_ele =(By.ID,"username")
    def add_member(self):
        """
        添加成员
        :return:
        """
        #导入做做写在内部,解决循环导入
        from test_wechat.train_step2.PO.contact_page import contact_page
        #输入姓名ID手机号

        # 可以跑了，这里需要先进入到目标界面在开始元素操作，，可以跟着录播视频写一遍
        #提高复用性，将定位元素写进类变量，但是注意find不接受元组，加*解包
        self.driver.find_element(*self.username_ele).send_keys("蒙多医生")
        self.driver.find_element(By.ID,"memberAdd_english_name").send_keys("祖安狂人")
        self.driver.find_element(By.ID,"memberAdd_acctid").send_keys("9513")
        self.driver.find_element(By.ID,"memberAdd_phone").send_keys("13429596711")
        #点击保存
        self.driver.find_element(By.CSS_SELECTOR,".js_btn_save").click()

        return contact_page(self.driver)